﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace github.heerheer.card2.UI.Converters
{
    class StringToListConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var r = new ObservableCollection<string>();
            foreach (var item in ((string)value ).Split(';'))
            {
                if(item!=string.Empty || item != null)
                {
                    r.Add(item);

                }

            }
            return r;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return new ObservableCollection<string>();
        }
    }
}
